package com.itshizhan.demo01.config;

import com.itshizhan.demo01.interceptor.JwtInterceptor;
import com.itshizhan.demo01.interceptor.LogProcessTimeHandlerInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author itshizhan
 * @email 370424110@qq.com
 * @date 2021-08-06
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer  {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(new LogProcessTimeHandlerInterceptor())
            .addPathPatterns("/**");

        registry.addInterceptor(new JwtInterceptor())
                .addPathPatterns("/**");
        //.order(1);

    }
}
